Scripting > CxEventIF > ValueQuery Object > ValueQuery Methods

ValueQuery Methods

The ValueQuery object contains the following methods:

CancelValueFiltering

The CancelValueFiltering method terminates execution of the query thread, and waits for the specified number of seconds.

Syntax

CancelValueFiltering(TimeToWaitInSeconds As Integer) As Boolean

Parameters

Parameter Required Description

TimeToWaitInSeconds

Yes

The number of seconds to wait for the value query to terminate. This value must be within the range [1 - 100].

Remark

This method will hang for the specified number of seconds while the query thread terminates. If the query thread has not terminated by the time the interval has expired, this method will return false and the query thread will continue to attempt to terminate in the background. Call this method as part of the cleanup routine after querying is finished.

Example

The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.

Sub

 

Dim bCreatedOk

bCreatedOk = ValueQuery.CreateValueFilter()

 

Dim bRunning

bRunning = ValueQuery.IsValueFilterRunning()

 

Dim bStarted

bStarted = ValueQuery.StartValueFiltering()

 

' retrieve the current value from a point tag (note that this

' query is designed to work with other queries that return lists

' of point tags, such as PointFacQuery)

Dim bRetrieved, pvValueInfoXml

bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml)

MsgBox pvValueInfoXml

 

ValueQuery.CancelValueFiltering(100)

End Sub

Back to top

CreateValueFilter

The CreateValueFilter method creates a new value query thread.

Syntax

CreateValueFilter() As Boolean

Example

The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.

Sub

 

Dim bCreatedOk

bCreatedOk = ValueQuery.CreateValueFilter()

 

Dim bRunning

bRunning = ValueQuery.IsValueFilterRunning()

 

Dim bStarted

bStarted = ValueQuery.StartValueFiltering()

 

' retrieve the current value from a point tag (note that this

' query is designed to work with other queries that return lists

' of point tags, such as PointFacQuery)

Dim bRetrieved, pvValueInfoXml

bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml)

MsgBox pvValueInfoXml

 

ValueQuery.CancelValueFiltering(100)

End Sub

Back to top

GetValueEntryAsXml

The GetValueEntryAsXml method returns the current value entry for the given tag.

Syntax

GetValueEntryAsXml(Tag As String, ValueInfoXml As Variant) As Boolean

Parameters

Parameter Required Description

Tag

Yes

A fully qualified point tag.

ValueInfoXml

Yes

The current value entry for the tag returned as an XML string.

Example

The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.

Sub

 

Dim bCreatedOk

bCreatedOk = ValueQuery.CreateValueFilter()

 

Dim bRunning

bRunning = ValueQuery.IsValueFilterRunning()

 

Dim bStarted

bStarted = ValueQuery.StartValueFiltering()

 

' retrieve the current value from a point tag (note that this

' query is designed to work with other queries that return lists

' of point tags, such as PointFacQuery)

Dim bRetrieved, pvValueInfoXml

bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml)

MsgBox pvValueInfoXml

 

ValueQuery.CancelValueFiltering(100)

End Sub

Back to top

IsValueFilterRunning

The IsValueFilterRunning method returns true if the value query thread is running.

Syntax

IsValueFilterRunning() As Boolean

Remark

The value query thread is executed after a value filter is created; therefore, after a value filter is created, this method will only return false if the filter has been canceled using CancelValueFiltering.

Example

The following example creates a value filter, checks that it is running, destroys it, and checks that it is no longer running.

Sub

 

Dim bCreatedOk

bCreatedOk = ValueQuery.CreateValueFilter()

 

Dim bRunning

bRunning = ValueQuery.IsValueFilterRunning()

 

MsgBox bRunning 'should be "True"

 

ValueQuery.CancelValueFiltering(100)

 

bRunning = ValueQuery.IsValueFilterRunning()

 

MsgBox bRunning 'should be "False"

 

End Sub

Back to top

StartValueFiltering

The StartValueFiltering method initiates value filtering on the background thread.

Syntax

StartValueFiltering() As Boolean

Remark

This method returns false if no value filter has been created.

Example

The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.

Sub

 

Dim bCreatedOk

bCreatedOk = ValueQuery.CreateValueFilter()

 

Dim bRunning

bRunning = ValueQuery.IsValueFilterRunning()

 

Dim bStarted

bStarted = ValueQuery.StartValueFiltering()

 

' retrieve the current value from a point tag (note that this

' query is designed to work with other queries that return lists

' of point tags, such as PointFacQuery)

Dim bRetrieved, pvValueInfoXml

bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml)

MsgBox pvValueInfoXml

 

ValueQuery.CancelValueFiltering(100)

 

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.